package br.uefs.ecomp.myBook.view;

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.LinkedList;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

import br.uefs.ecomp.myBook.model.Profile;

public class ProfileListTest extends JFrame implements ActionListener {
	private ProfileListTest() throws IOException{
		Profile p1, p2, p3, p4, p5;
		
		p1 = new Profile("p1", "12345", "Joao", "null", "null", "Salvador"/*, "Precisa disso?"*/, "None");
		p2 = new Profile("p2", "12345", "Pedro", "null", "null", "Feira", /*"Precisa disso?",*/ "None");
		p3 = new Profile("p3", "12345", "Joao Pedro", "null", "null", "Feira da Mata", /*"Precisa disso?",*/ "None");
		p4 = new Profile("p4", "12345", "Maria Joao", "null", "null", "Feira de Santana", /*"Precisa disso?",*/ "None");
		p5 = new Profile("p5", "12345", "Marta MAria", "null", "null", "Feira", /*"Precisa disso?",*/ "None");
		
		LinkedList<Profile> list = new LinkedList<>();
		
		list.add(p1);
		list.add(p2);
		list.add(p3);
		list.add(p4);
		list.add(p5);
		
		JPanel internalPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5));
		
		//this.setContentPane(internalPanel);
		
		setContentPane(new ProfileListPanel(list, this));
		
		
	}
	
	public static void main(String[] args) throws IOException{
		ProfileListTest window = new ProfileListTest();
		window.setVisible(true);
		window.revalidate();
		window.repaint();
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		JOptionPane.showMessageDialog(this, "Apertado: "+e.getActionCommand());
	}
	
}
